import Vue from 'vue'
import Router from 'vue-router'
import Hello from '@/components/Hello'
import School from '@/components/school'
import Page from 'page/page'
Vue.use(Router)

const index ={
  template:`<div>
    <h2>$route.params.id: {{$route.params.id}}</h2> 
      <h2>首页</h2>
     </div> `
} 
const second = {
  template:`<div>
      <h2>$route.params.username: {{$route.params.username}}</h2> 
      <h2>$route.query: {{$route.query}}</h2> 
      </div>`
}
export default new Router({
  mode:'history',
  base:'__dirname',
  routes: [
    {
      path: '/',
      name: 'Hello',
      components: {
        default:Page,
        left:{
          template:`<h2>左边栏</h2>`,
        },
        right:second
      }
    }, 
    {
      path: '/page',
      name: 'Page',
      component:Page,
      children:[
        {
          path:'',name:'second',component:second
        },
        {
          path:'index',name:'index',component:index
        },
        {
          path:'school',name:'vue',component:School
        },
        {
          path:':username',name:'学校',component:second
        }
      ]
    },
  ]
})
